1. Field of the Invention
This invention relates to multithreading processors and, more particularly, to managing the execution of multiple threads in a multithreading processor.
2. Description of the Related Art
Multithreading typically refers to executing multiple threads from one or more processes at a particular time. One type of multithreading processor is capable of executing multiple threads without using multiple cores. Multithreading may provide capabilities similar to a multiprocessor system (two or more logical processors) while using just one physical processor. A process refers to an application that is being executed by a processor. The process may consist of a private virtual address space, executable code, data and other operating system resources. Also, a process may have one or more execution threads. A thread, which is sometimes referred to as a lightweight process or execution context, is an execution path or flow of control through a given process. A thread's current state, which is represented by a current program counter, a call/return stack, the processor's registers, and some thread-specific data, allows the processor to freeze a thread (i.e., stop executing it) and to continue execution at a later time from the point where the thread was stopped.
Sharing a single processor between multiple threads may minimize the time required to switch between threads because a minimum amount of information may need to be saved and restored when switching from one thread to another. A minimum amount of information may need to be saved and restored because the program execution environment is shared between the different threads. This is in contrast to a standard context switch in a normal execution process.
Programmers write multithreaded application software to enhance the performance of an application. Since multithreaded programs may be written to execute in parallel instead of serially, multithreading may save execution time by allowing parts of a process to be independently executed.
Although current multithreading technologies may speed up the execution of processes by executing multiple threads at one time, a significant amount of execution time may be wasted on particular threads having instructions that are not ready to be executed. One method to overcome this problem is to switch from one thread to another or suspend execution of a current thread when the system detects that the current thread is taking too long to execute. For example, if execution of an instruction results in a cache miss or unavailability of resources during execution of the current thread, then the processor may switch to another thread that is ready-to be executed. However, this method may require executing the particular instruction that caused the cache miss, which may inherently result in wasted execution time.